<template>
    <div @click="backTop" class="backtop" :class="isShowBackTop ? 'show': ''">
        <i class="iconfont icon-fanhuidingbu"></i>
        <span class="txt">返回顶部</span>
    </div>
</template>

<script setup>
defineProps({
    'isShowBackTop': {
        type: Boolean,
        default: false
    }
})

const emit = defineEmits(['backTop'])

const backTop = () => {
    emit('backTop')
}
</script>

<style scoped lang="scss">
.backtop {
    right: 20px;
    bottom: 280px;
    position: fixed;
    height: 50px;
    line-height: 50px;
    width: 50px;
    z-index: 20;
    border-radius: 50%;
    text-align: center;
    background-color: $main-color;
    transform: scale(0);
    transition: all 0.2s linear;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    .iconfont {
        color: #fff;
        font-size: 30px;
    }
    .txt {
        font-size: 12px;
        color: $main-color;
    }

}
.show {
    transform: scale(1);
}
</style>